package com.novoda.runbuddy.activity;

import com.novoda.runbuddy.R;
import com.novoda.runbuddy.provider.ContentProviderRouteTest;
import com.novoda.runbuddy.provider.RunBuddyCP;
import com.novoda.runbuddy.util.DBUtil;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.test.ActivityInstrumentationTestCase;

public class RouteFTest extends ActivityInstrumentationTestCase<RouteViewer> {

	private RouteViewer activityClasse;
	
	private SQLiteDatabase		mdb;
	private static final String	TAG						= ContentProviderRouteTest.class.getName();
	private static final String	RUN_BUDDY_DB			= "runBuddyDB1.db";
	private DBUtil				dbUtil					= null;
	
	public RouteFTest(String pkg, Class<RouteViewer> activityClass) {
		super("com.novoda.runbuddy", RouteViewer.class);
	}
	
	public RouteFTest() {
		super("com.novoda.runbuddy", RouteViewer.class);
	}


	@Override
	protected void setUp() throws Exception {
		super.setUp();
		
		
		if (dbUtil == null) {
			dbUtil = new DBUtil(getActivity().getApplicationContext(), RUN_BUDDY_DB);
		}
		dbUtil.executeDB(R.raw.db_drop);

		dbUtil.createDB();
		dbUtil.insertValuesIntoDB();
		
		dbUtil.executeDB(R.raw.db_insert_long_route);
		
		mdb = dbUtil.getDatabase();
		if (mdb == null)
			mdb = getActivity().getApplicationContext().openOrCreateDatabase(RUN_BUDDY_DB, Context.MODE_PRIVATE, null);
	}

	@Override
	protected void tearDown() throws Exception {
		// TODO Auto-generated method stub
		super.tearDown();
	}

	@Override
	public void testActivityTestCaseSetUpProperly() throws Exception {
		super.testActivityTestCaseSetUpProperly();
	}
	
	public void testTrue() throws Exception {
        getInstrumentation().waitForIdleSync();
        Thread.sleep(5000);
		assertTrue(true);
	}
}
